﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using cbmobile.BLC;
using PQT.API;
using cbmobile.DAC;

namespace cbmobile.UserControl
{
    public partial class Member_Entry : CommonUserControl
    {
        BLC_Member blc = new BLC_Member();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected string IDNavigate(object IDU)
        {
            string id = "/RenderMain.aspx?muid=DoiMatKhau&UserID=" + IDU;
            return id;
        }


        private void BindControlField()
        {
            Member ent = blc.Get_Member_By_ID(this.User_ID);

            DropDownList ddlStatus = frmBlogCate.FindControl("ddlStatus") as DropDownList;
            if (ddlStatus != null)
            {
                ddlStatus.Items.Clear();

                ddlStatus.Items.Add(new ListItem(CommonStatus.Inactive.ToString(), ((int)CommonStatus.Inactive).ToString()));
                ddlStatus.Items.Add(new ListItem(CommonStatus.Active.ToString(), ((int)CommonStatus.Active).ToString()));

                if (ent != null)
                {
                    ddlStatus.SelectedValue = ent.TrangThai.ToString();
                }
            }
        }


        private DropDownList findcontrol_DropList(string findcontrol)
        {
            return frmBlogCate.FindControl(findcontrol) as DropDownList;
        }


        protected string StatusName(object StatusID)
        {
            return StatusID != null ? ((CommonStatus)StatusID).ToString() : string.Empty;
        }


        protected int User_ID
        {
            get
            {
                return Utility.ValidateParam("UserID", 0);
            }
        }

        protected void frmBlogCate_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {

        }

        protected void frmBlogCate_ItemInserted(object sender, FormViewInsertedEventArgs e)
        {
            Response.Redirect(this.ListLink);
        }

        protected void frmBlogCate_DataBound(object sender, EventArgs e)
        {
            BindControlField();
        }

        protected void ObjectDataSource1_Updating(object sender, ObjectDataSourceMethodEventArgs e)
        {
            DropDownList ddlStatus = frmBlogCate.FindControl("ddlStatus") as DropDownList;
            e.InputParameters["TrangThai"] = ddlStatus.SelectedValue;
        }
    }
}